package qldc.pm.qlktcsdldc.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import qldc.pm.qlktcsdldc.model.NguoiDung;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import java.util.Date;

/**
 * The cache model class for representing NguoiDung in entity cache.
 *
 * @author Brian Wing Shun Chan
 * @see NguoiDung
 * @generated
 */
public class NguoiDungCacheModel implements CacheModel<NguoiDung>,
    Externalizable {
    public long IDQLKT_NguoiDung;
    public long groupId;
    public long companyId;
    public long userId;
    public String userName;
    public long createDate;
    public long modifiedDate;
    public String TenDangNhap;
    public String HoVaTen;
    public String SoCMND;
    public long IDTinhThuongTru;
    public long IDQuanHuyenThuongTru;
    public long IDPhuongXaThuongTru;
    public String DiaChiThuongTru;
    public long IDQLKT_DanhMucSoBanNganh;
    public int GioiTinh;
    public long DanToc;
    public String ChuThich;
    public Boolean deleted;
    public Boolean KichHoat;

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(41);

        sb.append("{IDQLKT_NguoiDung=");
        sb.append(IDQLKT_NguoiDung);
        sb.append(", groupId=");
        sb.append(groupId);
        sb.append(", companyId=");
        sb.append(companyId);
        sb.append(", userId=");
        sb.append(userId);
        sb.append(", userName=");
        sb.append(userName);
        sb.append(", createDate=");
        sb.append(createDate);
        sb.append(", modifiedDate=");
        sb.append(modifiedDate);
        sb.append(", TenDangNhap=");
        sb.append(TenDangNhap);
        sb.append(", HoVaTen=");
        sb.append(HoVaTen);
        sb.append(", SoCMND=");
        sb.append(SoCMND);
        sb.append(", IDTinhThuongTru=");
        sb.append(IDTinhThuongTru);
        sb.append(", IDQuanHuyenThuongTru=");
        sb.append(IDQuanHuyenThuongTru);
        sb.append(", IDPhuongXaThuongTru=");
        sb.append(IDPhuongXaThuongTru);
        sb.append(", DiaChiThuongTru=");
        sb.append(DiaChiThuongTru);
        sb.append(", IDQLKT_DanhMucSoBanNganh=");
        sb.append(IDQLKT_DanhMucSoBanNganh);
        sb.append(", GioiTinh=");
        sb.append(GioiTinh);
        sb.append(", DanToc=");
        sb.append(DanToc);
        sb.append(", ChuThich=");
        sb.append(ChuThich);
        sb.append(", deleted=");
        sb.append(deleted);
        sb.append(", KichHoat=");
        sb.append(KichHoat);
        sb.append("}");

        return sb.toString();
    }

    @Override
    public NguoiDung toEntityModel() {
        NguoiDungImpl nguoiDungImpl = new NguoiDungImpl();

        nguoiDungImpl.setIDQLKT_NguoiDung(IDQLKT_NguoiDung);
        nguoiDungImpl.setGroupId(groupId);
        nguoiDungImpl.setCompanyId(companyId);
        nguoiDungImpl.setUserId(userId);

        if (userName == null) {
            nguoiDungImpl.setUserName(StringPool.BLANK);
        } else {
            nguoiDungImpl.setUserName(userName);
        }

        if (createDate == Long.MIN_VALUE) {
            nguoiDungImpl.setCreateDate(null);
        } else {
            nguoiDungImpl.setCreateDate(new Date(createDate));
        }

        if (modifiedDate == Long.MIN_VALUE) {
            nguoiDungImpl.setModifiedDate(null);
        } else {
            nguoiDungImpl.setModifiedDate(new Date(modifiedDate));
        }

        if (TenDangNhap == null) {
            nguoiDungImpl.setTenDangNhap(StringPool.BLANK);
        } else {
            nguoiDungImpl.setTenDangNhap(TenDangNhap);
        }

        if (HoVaTen == null) {
            nguoiDungImpl.setHoVaTen(StringPool.BLANK);
        } else {
            nguoiDungImpl.setHoVaTen(HoVaTen);
        }

        if (SoCMND == null) {
            nguoiDungImpl.setSoCMND(StringPool.BLANK);
        } else {
            nguoiDungImpl.setSoCMND(SoCMND);
        }

        nguoiDungImpl.setIDTinhThuongTru(IDTinhThuongTru);
        nguoiDungImpl.setIDQuanHuyenThuongTru(IDQuanHuyenThuongTru);
        nguoiDungImpl.setIDPhuongXaThuongTru(IDPhuongXaThuongTru);

        if (DiaChiThuongTru == null) {
            nguoiDungImpl.setDiaChiThuongTru(StringPool.BLANK);
        } else {
            nguoiDungImpl.setDiaChiThuongTru(DiaChiThuongTru);
        }

        nguoiDungImpl.setIDQLKT_DanhMucSoBanNganh(IDQLKT_DanhMucSoBanNganh);
        nguoiDungImpl.setGioiTinh(GioiTinh);
        nguoiDungImpl.setDanToc(DanToc);

        if (ChuThich == null) {
            nguoiDungImpl.setChuThich(StringPool.BLANK);
        } else {
            nguoiDungImpl.setChuThich(ChuThich);
        }

        nguoiDungImpl.setDeleted(deleted);
        nguoiDungImpl.setKichHoat(KichHoat);

        nguoiDungImpl.resetOriginalValues();

        return nguoiDungImpl;
    }

    @Override
    public void readExternal(ObjectInput objectInput) throws IOException {
        IDQLKT_NguoiDung = objectInput.readLong();
        groupId = objectInput.readLong();
        companyId = objectInput.readLong();
        userId = objectInput.readLong();
        userName = objectInput.readUTF();
        createDate = objectInput.readLong();
        modifiedDate = objectInput.readLong();
        TenDangNhap = objectInput.readUTF();
        HoVaTen = objectInput.readUTF();
        SoCMND = objectInput.readUTF();
        IDTinhThuongTru = objectInput.readLong();
        IDQuanHuyenThuongTru = objectInput.readLong();
        IDPhuongXaThuongTru = objectInput.readLong();
        DiaChiThuongTru = objectInput.readUTF();
        IDQLKT_DanhMucSoBanNganh = objectInput.readLong();
        GioiTinh = objectInput.readInt();
        DanToc = objectInput.readLong();
        ChuThich = objectInput.readUTF();
        deleted = objectInput.readBoolean();
        KichHoat = objectInput.readBoolean();
    }

    @Override
    public void writeExternal(ObjectOutput objectOutput)
        throws IOException {
        objectOutput.writeLong(IDQLKT_NguoiDung);
        objectOutput.writeLong(groupId);
        objectOutput.writeLong(companyId);
        objectOutput.writeLong(userId);

        if (userName == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(userName);
        }

        objectOutput.writeLong(createDate);
        objectOutput.writeLong(modifiedDate);

        if (TenDangNhap == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(TenDangNhap);
        }

        if (HoVaTen == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(HoVaTen);
        }

        if (SoCMND == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(SoCMND);
        }

        objectOutput.writeLong(IDTinhThuongTru);
        objectOutput.writeLong(IDQuanHuyenThuongTru);
        objectOutput.writeLong(IDPhuongXaThuongTru);

        if (DiaChiThuongTru == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(DiaChiThuongTru);
        }

        objectOutput.writeLong(IDQLKT_DanhMucSoBanNganh);
        objectOutput.writeInt(GioiTinh);
        objectOutput.writeLong(DanToc);

        if (ChuThich == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(ChuThich);
        }

        objectOutput.writeBoolean(deleted);
        objectOutput.writeBoolean(KichHoat);
    }
}
